﻿using System.Collections.Generic;
using System.Linq;
using MaxStoreErp.Core.Extensions;
using MaxStoreShop.Domain.Directories;
using MaxStoreShop.Logic.RepositoriesContracts.Directories;

namespace MaxStoreShop.Dal.Repositories.Directories
{
    public class StorageLocationRepository : RepositoryBase, IStorageLocationRepository
    {
        public IEnumerable<StorageLocation> GetAllStorageLocations()
        {
            return Context.StorageLocations.AsNoTracking().NotDeleted();
        }

        public void DeleteStorageLocation(int storageLocationId)
        {
            SafeDelete(Context.StorageLocations.First(c => c.Id == storageLocationId));
        }

        public void SaveStorageLocation(StorageLocation storageLocation)
        {
            SaveEntity(storageLocation);
        }
    }
}
